/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LIUYANJIAO
 * Date: 2024-09-20
 * Time: 20:20
 */
class demo<T>{
    public Object[] arr=new Object[10];

    public T getArr(int pos) {
        return (T)arr[pos];
    }

    public void setArr(int pos,T val) {
        this.arr[pos] = val;
    }
}
class demo0<E extends Number>{
    public Object[] arr=new Object[10];

    public E getArr(int pos) {
        return (E)arr[pos];
    }

    public void setArr(int pos,E val) {
        this.arr[pos] = val;
    }
}
public class Main {
    public static<E> void main(String[] args) {
        demo0<Integer> arr=new demo0<>();
        //demo0<String> arr1=new demo0<String>();
    }
    public static<T> void main5(String[] args) {
        demo<String> arr=new demo<>();
        arr.setArr(0,"哈哈哈哈");
        System.out.println(arr.getArr(0));
    }

    public static <T> void main4(String[] args) {
        demo<Integer> arr=new demo<>();
        arr.setArr(0, 100 );
        System.out.println(arr.getArr(0));
    }
    public static void main3(String[] args) {
        int[] arr1={1,2,3,4,5,6};
        char[] arr2={'a','b','c','d','e'};
    }
    public static void main2(String[] args) {
        //自动装箱
        Integer i1=10;
        //自动拆箱
        int i2=i1;
        System.out.println(i1);
        System.out.println(i2);
    }
    public static void main1(String[] args) {
        int i=10;
        //装箱操作，新建一个Integer类型对象，手动将i的值放入对象的某个属性中
        Integer ii=Integer.valueOf(i);

        //拆箱操作，将Integer对象中的值取出，放到一个基础类型中
        int j=ii.intValue();

        System.out.println(i);
        System.out.println(ii);
        System.out.println(j);
    }
}